<template> 

    <div class="text">
        <el-text
        id="text"
        type="danger"
        >
            成为点评专家
        </el-text>
    </div>

    <div id="re_box">
        <!-- 输入账号 -->
        
        <el-input 
        class="input"
        v-model="username"
        placeholder="Please input 账号" 
        type="text"
        clearable
        size="large"
        />

        <!-- 输入密码 -->
        <el-input 
        
        class="input"
        v-model="password"
        placeholder="Please input 密码" 
        type="password"
        clearable
        show-password
        size="large"
        /> 
        
        <!-- 提交按钮 -->
        <el-button @click="Submit" id="button">提交</el-button>
    </div>

   
    
</template>

<script>
import axios from 'axios';
import * as api from '@/api';
export default{
    data(){
        return{
            username:'',
            password:''
        }
    },
    methods:{
        Submit(){
        const registerUrl = api.getRegisterUrl();    
        axios
            .post(registerUrl,{
                "username":this.username,
                "password":this.password
            })
            .then(response=>{
                var  _this=this;
                if(response.status==200){
                    if(response.data.code==1){
                         _this.$router.push({
                        path:"/"
                        })
                    }else{
                        _this.$alert('找不到服务器⊙﹏⊙∥!', '失败!');
                    }
                }
            })
        }
    }
}
</script>

<style>
#re_box{
    background-color:#eb4e4e60;
    width: 30%;
    margin: auto;
    
    height: 500px;
    border-radius:10px;
    text-align: center;
    padding: 45px 45px;
}

.input{
    margin-top:10% ;
}

.text{
    text-align: center;
}

#text{
    font-size: 100px;
}

#button{
    margin-top:10% ;
}

</style>